Accessing data from containers and creating new containers
A container site refers to a site that a container is at. With this site, the current status of the container at that site such as weight can be queried.
While containers at a container site may be replaced, emptied, filled up, etc., the container site will remain the same
For more information on the relationship between a container site and a BinBar visit Associating a BinBar with a Container Site
For information on what can be queried refer to the container site documentation
How to create a new container site
1. Find the ID of the service location in which the container site will belong. For more information on how to query service locations, visit Accessing data from service locations and creating new service locatiions
2. Create a new container site using the mutation createContainerSite
- Query
- Result
mutation CreateContainerSite($input: CreateContainerSiteInput!) {
createContainerSite(input: $input) {
__typename
name
id
# Some 'containerSite' fields omitted for brevity
}
}
variables = {
input: {
name: 'My New Container Site',
serviceLocationID: serviceLocationID,
maxWeight: { value: 12.5, unit: 'KILOGRAM' },
size: 24
}
}
{
"data": {
"createContainerSite": {
"__typename": "ContainerSite",
"name": "My New Container Site",
"id": "1235adscion345cae3"
}
}
}
When creating new service locations, container sites, and BinBars, it may be useful to query for that ID at the same time so you do not have to query for it later if you are doing a operation with it immediatley after
How to find all container sites
Using the query currentUser
- Query
- Result
query currentUser {
currentUser {
account {
containerSites {
__typename
name
id
# Some 'containerSite' fields omitted for brevity
}
}
}
}
{
"data": {
"currentUser": {
"account": {
"containerSites": [
{
"__typename": "ContainerSite",
"name": "Container Site #5324",
"id": "23498cadfe3234cf23432cdsf"
},
{
"__typename": "ContainerSite",
"name": "My New Container Site",
"id": "23498cadfe3234cf232342cdsg"
}
]
}
}
}
}
Larger queries will take longer to retrieve. For larger queries, we recommend using the optional paginationInput. To learn more, visit Paginating Queries
How to find a container sites's information with an ID
Using the query containerSiteByID
- Query
- Result
query ContainerSiteByID($id: ID!) {
containerSiteByID(id: $id) {
__typename
id
name
# Some 'containerSite' fields omitted for brevity
}
}
variables = { id: '23498cadfe3234cf232342cdsg' };
{
"data": {
"containerSiteByID": {
"__typename": "ContainerSite",
"id": "23498cadfe3234cf232342cdsg",
"name": "My New Container Site"
}
}
}